#ifndef _SURFACE_H_
#define _SURFACE_H_

#include "math/vec2.h"
#include "resman/resource_file.h"
#include "color.h"

struct	AlphaMask
{
	AlphaMask()
	{
		Width = Height = 0;
		AlphaVal = NULL;
	}
	~AlphaMask()
	{
		if (AlphaVal)
		{
			delete [] AlphaVal;
			AlphaVal = NULL;
		}
	}
	int					Width, Height;
	unsigned char*		AlphaVal;
};

class Surface : public res::ResourceFile
{
public:

	/// set the surface as a texture to the stage
	virtual bool			SetTextureStage(unsigned int _TexStage) = 0;

	unsigned int			GetWidth();
	unsigned int			GetHeight();
	unsigned int			GetSize() const { return m_Size; };

	virtual AlphaMask*		GenerateMask() = 0;
	virtual COLOR*			GetPixels() = 0;		// gets the top-level surface
	virtual float*			GetColors() = 0;		// gets the top-level surface as quintuples
	virtual	void 			GetTexMemory(unsigned int &TexMem, unsigned int &TexMemComp, unsigned int &TexMemFullC, unsigned int &TexMemPal) =0;
    virtual void			InitializeResource();

protected:
	// private
	Surface();
	virtual ~Surface();

	/// functions used to instantiate data
	
	virtual void			ReleaseResource();
	virtual void			InitTexture() = 0;

	unsigned int			m_Width;
	unsigned int			m_Height;
	unsigned int			m_Size;
	bool					m_IsCubemap;
};

#endif // _SURFACE_H_